package cn.gok.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: chen fan
 * @since: 2022/11/3 18:07
 * @description:
 */
@Controller
public class UserController {

    @RequestMapping("/user/login.do")
    @ResponseBody
    public Map<String,String> login(String userName, String password){

        Map<String,String> result = new HashMap<>();
        if ( "zhangsan".equals(userName) && "123456".equals(password)){
            result.put("code","1");
            result.put("msg","登录成功");
            return result;
        }
        result.put("code","0");
        result.put("msg","登录失败");
        return result;
    }

    @RequestMapping("/user/updateUser.do")
    @ResponseBody
    public Map<String,String> updateUser(Integer userId,String userName){
        System.out.println("userId: " + userId);
        System.out.println("userName: " + userName);
        Map<String,String> result = new HashMap<>();
        result.put("code","1");
        result.put("msg","修改失败");
        return result;
    }

}
